package com.imast.android.bys.ui.fragment;

import com.imast.android.bys.BySApplication;
import com.imast.android.bys.R;
import com.imast.android.bys.adapter.CarroCompraAdapter;
import com.imast.android.bys.io.model.CarroCompraItem;

import android.support.v4.app.FragmentActivity;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.ListView;

public class CarritoCompraHelper {

	private FragmentActivity mActivity;
	private ActionBar actionBar;
	private CarritoCompraFragment fragment;
	private ListView lv;
		
	public FragmentActivity getActivity() {
		return mActivity;
	}

	public ActionBar getActionBar() {
		return actionBar;
	}
	
	public ListView getLv() {
		return lv;
	}

	public CarritoCompraHelper(FragmentActivity mActivity, View rootView, CarritoCompraFragment fragment) {
		this.mActivity = mActivity;
		this.actionBar = ((ActionBarActivity)mActivity).getSupportActionBar();
		this.fragment = fragment;
		initConfig();
	}
	
	private void initConfig(){
		
		BySApplication app = (BySApplication) getActivity().getApplicationContext();
		
		lv = (ListView) fragment.getListView();
		lv.setAdapter(new CarroCompraAdapter(getActivity(), app.getLstCompra()));
		
	}
}
